package com.yanqu.road.entity.cricket.court;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.FieldTypeAnnotation;

import java.sql.Types;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
 * 竞技场用户信息
 */
@FieldTypeAnnotation(tableName = "t_c_cricket_court_user_data")
public class CricketCourtUserData extends DataObject {

    @FieldTypeAnnotation(desc = "服务器id", select = true, update = true)
    private long serverId;

    @FieldTypeAnnotation(desc = "用户id", select = true, update = true)
    private long userId;

    @FieldTypeAnnotation(desc = "赛场id,-1为无赛场")
    private int courtId;

    @FieldTypeAnnotation(desc = "分组id,-1为未分组")
    private int groupId;

    @FieldTypeAnnotation(desc = "积分")
    private long score;

    @FieldTypeAnnotation(desc = "排行榜额外参数,备用")
    private String param = "";

    @FieldTypeAnnotation(desc = "轮次")
    private int round;

    @FieldTypeAnnotation(desc = "上一次赛场id,-1为无赛场")
    private int lastCourtId;

    @FieldTypeAnnotation(desc = "上一轮组内排名,-1为未上榜")
    private int lastRank;

    @FieldTypeAnnotation(desc = "上一轮分组人数")
    private int lastGroupNum;

    @FieldTypeAnnotation(desc = "积分更新时间")
    private long updateTime;

    @FieldTypeAnnotation(desc = "竞技场勋章id")
    private int courtBadgeId;

    @FieldTypeAnnotation(desc = "防守阵容", sqlType = Types.LONGVARCHAR)
    private List<CricketCourtDefenseData> defenseDataList = new ArrayList<>();

    public CricketCourtUserData() {

    }

    public long getServerId() {
        return serverId;
    }

    public void setServerId(long serverId) {
        if (this.serverId != serverId) {
            this.serverId = serverId;
            this.setUpdateOption();
        }
    }

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        if (this.userId != userId) {
            this.userId = userId;
            this.setUpdateOption();
        }
    }

    public int getCourtId() {
        return courtId;
    }

    public void setCourtId(int courtId) {
        if (this.courtId != courtId) {
            this.courtId = courtId;
            this.setUpdateOption();
        }
    }

    public int getGroupId() {
        return groupId;
    }

    public void setGroupId(int groupId) {
        if (this.groupId != groupId) {
            this.groupId = groupId;
            this.setUpdateOption();
        }
    }

    public long getScore() {
        return score;
    }

    public void setScore(long score) {
        if (this.score != score) {
            this.score = score;
            this.setUpdateOption();
        }
    }

    public String getParam() {
        return param;
    }

    public void setParam(String param) {
        if (!Objects.equals(this.param, param)) {
            this.param = param;
            this.setUpdateOption();
        }
    }

    public int getRound() {
        return round;
    }

    public void setRound(int round) {
        if (this.round != round) {
            this.round = round;
            this.setUpdateOption();
        }
    }

    public int getLastCourtId() {
        return lastCourtId;
    }

    public void setLastCourtId(int lastCourtId) {
        if (this.lastCourtId != lastCourtId) {
            this.lastCourtId = lastCourtId;
            this.setUpdateOption();
        }
    }

    public int getLastRank() {
        return lastRank;
    }

    public void setLastRank(int lastRank) {
        if (this.lastRank != lastRank) {
            this.lastRank = lastRank;
            this.setUpdateOption();
        }
    }

    public int getLastGroupNum() {
        return lastGroupNum;
    }

    public void setLastGroupNum(int lastGroupNum) {
        if (this.lastGroupNum != lastGroupNum) {
            this.lastGroupNum = lastGroupNum;
            this.setUpdateOption();
        }
    }

    public long getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(long updateTime) {
        if (this.updateTime != updateTime) {
            this.updateTime = updateTime;
            this.setUpdateOption();
        }
    }

    public int getCourtBadgeId() {
        return courtBadgeId;
    }

    public void setCourtBadgeId(int courtBadgeId) {
        if (this.courtBadgeId != courtBadgeId) {
            this.courtBadgeId = courtBadgeId;
            this.setUpdateOption();
        }
    }

    public List<CricketCourtDefenseData> getDefenseDataList() {
        return defenseDataList;
    }

    public void setDefenseDataList(List<CricketCourtDefenseData> defenseDataList) {
        if (defenseDataList == null) {
            return;
        }
        this.defenseDataList = defenseDataList;
        this.setUpdateOption();
    }
}
